<template>
  <Layout class="p-5 bg-white">
    <Form :label-width="100">
      <h3>学生详细</h3>
      <FormItem class="w-50" label="学生姓名">
        <Input v-model="student.name" placeholder="请输入回访人"></Input>
      </FormItem>

      <FormItem class="w-50" label="身份证号">
        <Input v-model="student.secId" placeholder="身份证号"></Input>
      </FormItem>

      <FormItem class="w-50" label="身份证正面">
        <Input v-model="student.secFrontUrl" placeholder="身份证正面"></Input>
      </FormItem>

      <FormItem class="w-50" label="身份证背面">
        <Input v-model="student.secBackUrl" placeholder="身份证背面"></Input>
      </FormItem>

      <FormItem class="w-50" label="身份证手持">
        <Input v-model="student.secHandleUrl" placeholder="身份证手持"></Input>
      </FormItem>

      <FormItem class="w-50" label="出生日期">
        <Input v-model="student.birth" placeholder="出生日期"></Input>
      </FormItem>

      <FormItem class="w-50" label="毕业日期">
        <Input v-model="student.graduateTime" placeholder="出生日期"></Input>
      </FormItem>

      <h3>线索详细</h3>

      <FormItem class="w-50" label="线索来源">
        <Input v-model="resource.source" placeholder="线索来源"></Input>
      </FormItem>

      <FormItem class="w-50" label="线索状态">
        <Input v-model="resource.statu" placeholder="线索状态"></Input>
      </FormItem>

      <FormItem class="w-50" label="应聘职位">
        <Input v-model="resource.ypzw" placeholder="应聘职位"></Input>
      </FormItem>

      <FormItem class="w-50" label="从事工作">
        <Input v-model="resource.csgz" placeholder="从事工作"></Input>
      </FormItem>

      <FormItem class="w-50" label="线索备注">
        <Input v-model="resource.bz" placeholder="线索备注"></Input>
      </FormItem>

      <FormItem class="w-50" label="线索跟进人">
        <Input v-model="resource.autor" placeholder="线索跟进人"></Input>
      </FormItem>

      <FormItem class="w-50" label="阶段Id">
        <Input v-model="resource.stageId" placeholder="阶段Id"></Input>
      </FormItem>

      <!--按钮-->
      <FormItem class="text-right">
        <Button @click="submit" type="primary">提交</Button>
        <Button @click="cancel" class="ml-2">取消</Button>
      </FormItem>
    </Form>
    <!--表单-->

    <Table
      border
      :class="'m-1'"
      :columns="tableInfo.columnInfo"
      :data="tableInfo.data"
    >
      <template slot-scope="{ row, index }" slot="status">
        <span v-if="row.statu">开</span>
        <span v-else>关</span>
      </template>
      <template slot-scope="{ row, index }" slot="action">
        <Row>
          <Col>
            <Menu>
              <Submenu name="1">
                <template slot="title">
                  <Icon type="ios-paper" />
                  操作选项
                </template>
                <!-- <Button type="error" size="small" @click="remove(row.backviewId)">删除</Button>
						<br>
						<Button type="primary" size="small" style="margin-right: 5px"
							@click="showPersonDetail(row)">详细</Button>
						<br>
						<Button type="error" @click="showLifeCycle(row)">生命周期</Button> -->
              </Submenu>
            </Menu>
          </Col>
        </Row>
      </template>
    </Table>
  </Layout>
</template>

<script>
export default {
  data() {
    return {
      student: {
        id: null,
        name: '',
        secId: null,
        secFrontUrl: '',
        secBackUrl: '',
        secHandleUrl: '',
        tel: '',
        birth: '',
        graduateTime: null,
      },
      resource: {
        id: null,
        source: '',
        statu: '',
        ypzw: '',
        csgz: '',
        tdgsmc: '',
        bz: '',
        autor: '',
        stageId: '',
      },
      tableInfo: {
        currentPage: 1,
        total: 0,
        pageSize: 10,
        columnInfo: [
          //表头-----------------------------------
          {
            title: '线索记录编号',
            key: 'id',
          },
          {
            title: '文件图片路径',
            key: 'content',
          },
          {
            title: '添加时间',
            key: 'ct',
          },
          {
            title: '更新时间',
            key: 'ut',
          },
          {
            title: '线索记录跟进人',
            key: 'autor',
          },
          {
            title: '操作',
            slot: 'action',
            width: 150,
          },
        ],
        data: [],
      },
    } //return
  },
  methods: {
    changeP: function(selectedPermissionId) {},
    submit: function() {
      let _this = this

      // let method = _this.backview.method;

      this.http
        .put({
          url: 'http://127.0.0.1:8888/iou/backview',
          params: {},
        })
        .then((data) => {
          _this.message.info('修改成功')
          _this.$tabs.close()
        })
    },
    cancel: function() {
      this.$tabs.close()
    },
    strToDate: function(datestr) {
      return new Date(datestr)
    },
  },
  created: function() {
    let _this = this

    this.http
      .get({
        url: '/student/info/' + this.$route.params.row.studentId,
      })
      .then((data) => {
        _this.student.name = data.student.name
        _this.student.secId = data.student.secId
        _this.student.secFrontUrl = data.student.secFrontUrl
        _this.student.secBackUrl = data.student.secBackUrl
        _this.student.secHandleUrl = data.student.secHandleUrl
        _this.student.birth = data.student.birth
        _this.student.graduateTime = data.student.graduateTime

        _this.resource.source = data.resource.source
        _this.resource.statu = data.resource.statu
        _this.resource.ypzw = data.resource.ypzw
        _this.resource.csgz = data.resource.csgz
        _this.resource.bz = data.resource.bz
        _this.resource.autor = data.resource.autor
        _this.resource.stageId = data.resource.stageId

        this.$data.tableInfo.currentPage = 1
        this.$data.tableInfo.pageSize = 10
        this.$data.tableInfo.data = data.resourceRecord
      })
  },
}
</script>

<!-- 	self.$data.allStages.push({  //XX
						id: 0,
						name: "线索阶段"
					}); -->
